package com.juc.lock;

import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * @author: 一个小菜逼
 * @Date: 2020/5/2
 */
public class MyReadWriteLock {

    public static void main(String[] args) {
        ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock();
        //读锁加锁、解锁
        reentrantReadWriteLock.readLock().lock();
        reentrantReadWriteLock.readLock().unlock();

        //写锁加锁、解锁
        reentrantReadWriteLock.writeLock().lock();
        reentrantReadWriteLock.writeLock().unlock();
    }
}
